﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMaster.Master" AutoEventWireup="true" CodeBehind="Categories.aspx.cs" Inherits="Realisticsoft.Tesdo.Admin.Categories" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphAdmin" runat="server">
    <script src="Scripts/jquery.colorbox.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $(".addNew").colorbox({ width: "500px", inline: true, href: "#frmAddNew" });
        });

        function closeOverlay() {
            $.colorbox.close();
        }
    </script>
    <div class="content-box-outer">
        <div class="content-box-right">
        </div>
        <div class="content-box-left">
            <h1>Categories<a href="#" class="addNew">Add new category</a></h1>
            
            <div style="display: none;" id="categoryare" runat="server">
                <div id="frmAddNew" class="overlaypanel">
                    <h2><asp:Label Text="Add New category" ID="lblCatTitle" runat="server" /></h2>
                    <ul class="fl">
                        <li>
                            <asp:Label ID="lblNewCategory" runat="server" AssociatedControlID="txtNewCategory"
                                Text="Title" /><br />
                            <asp:TextBox runat="Server" ID="txtNewCategory" Width="200" MaxLength="50" />
                            <asp:CustomValidator runat="Server" ID="valExist" ValidationGroup="new" ControlToValidate="txtNewCategory"
                                ErrorMessage="Alread esxit" Display="dynamic" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="Server" ValidationGroup="new"
                                ControlToValidate="txtNewCategory" ErrorMessage="enter valid name" Display="Dynamic" />
                        </li>
                        <li>
                            <asp:Label ID="lblNewNewDescription" runat="server" AssociatedControlID="txtNewNewDescription"
                                Text="Short Desciption" /><br />
                            <asp:TextBox runat="Server" ID="txtNewNewDescription" Width="400" TextMode="MultiLine"
                                Rows="4" MaxLength="250" />
                        </li>
                        <li>
                            <asp:Label ID="lblNewParent" runat="server" AssociatedControlID="ddlNewParent" Text="parent" /><br />

                            <asp:DropDownList ID="ddlNewParent" Width="200px" runat="server"
                                DataSourceID="SqlDSParentDropDown" DataTextField="Title"
                                DataValueField="JournalID" >
                               <%-- <asp:ListItem Value="0">None</asp:ListItem>--%>
                            </asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDSParentDropDown" runat="server"
                                ConnectionString="<%$ ConnectionStrings:connicationStringTesdo %>"
                                SelectCommand="SELECT * FROM [tblJournals] ORDER BY [Title]"></asp:SqlDataSource>
                        </li>
                    </ul>
                    <asp:Button runat="server" ID="btnAdd" ValidationGroup="new"
                        CssClass="btn primary"
                        OnClientClick="colorboxDialogSubmitClicked('new', 'frmAddNew');" Text="Add"
                        OnClick="btnAdd_Click" />
                    or <a href="#" onclick="closeOverlay();">Cancel</a>
                </div>
            </div>
             <div class="MessageArea">
                <asp:Label Text="" ID="lblMsg" runat="server" />
            </div>
            <div>
                
                <asp:GridView ID="gvCategories" runat="server" AutoGenerateColumns="False" CellPadding="4"
                ForeColor="Black" GridLines="Vertical" OnRowCommand="gvCategories_RowCommand"
                AllowPaging="True" OnPageIndexChanging="gvCategories_PageIndexChanging"
                Width="988px" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px">
                <RowStyle BackColor="#F7F7DE" />
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:TemplateField HeaderText="Journal Title">
                        <ItemTemplate>
                            <%# Eval("objJournal.Title") %>
                        </ItemTemplate>
                        <ItemStyle Width="350px"></ItemStyle>
                    </asp:TemplateField>
                    <asp:BoundField DataField="Title" HeaderText="Categories"></asp:BoundField>
                    <asp:TemplateField HeaderText="Actions">
                        <ItemTemplate>
                            <asp:ImageButton ID="ImageButtonEdit" Width="15" ToolTip="Edit" CommandArgument='<%#Eval("CategoryID") %>'
                                CommandName="cmdUpdate" CausesValidation="False" runat="server" ImageUrl="images/edit.png" />
                            <asp:ImageButton ID="ImageButtonDelete" Width="15" ToolTip="Delete" CommandArgument='<%#Eval("CategoryID") %>'
                                CommandName="cmdDelete" OnClientClick="return confirm('Are you sure you when to delete this category?');" CausesValidation="False"
                                runat="server" ImageUrl="images/delete.png" />
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#CCCC99" />
                <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />

                <SortedAscendingCellStyle BackColor="#FBFBF2" />
                <SortedAscendingHeaderStyle BackColor="#848384" />
                <SortedDescendingCellStyle BackColor="#EAEAD3" />
                <SortedDescendingHeaderStyle BackColor="#575357" />

            </asp:GridView>
            </div>
            
        </div>
    </div>
</asp:Content>
